import org.flywaydb.core.Flyway;

/**
 * Created by heren on 2014/10/13.
 */
public class Main {
    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        migrationDb();
        System.out.print("执行版本控制成功");
    }


    /**
     * 数据库版本控制
     */
    public static void migrationDb() {

        Flyway flyway = new Flyway();
        //设置数据库链接配置
        //flyway.setDataSource("jdbc:mysql://127.0.0.1:3306/jims-his","root","123456");
        flyway.setDataSource("jdbc:mysql://127.0.0.1:3306/jims-his","root","123456");
        //设置schema用户
       // flyway.setSchemas("his");
        //flyway.setTable("SCHEMA_VERSION");
        flyway.setEncoding("UTF-8");
//        flyway.setValidateOn.Migrate(true);
        //清空所有表结构
        flyway.clean();
//        flyway.setTargetAsString("1");
        //初始化flyWAy
        //执行版本控制
        flyway.migrate();
        //我的测试提交
    }
}
